package com.yk.mr.model.file;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "file", schema = "cykmr", catalog = "")
public class FileModel {
    private String fileId;
    private String fileName;
    private String filePath;
    private Double size;
    private String remark;
    private Timestamp createTime;
    private Timestamp updateTime;

    @Id
    @Column(name = "FILE_ID", nullable = false, length = 255)
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    @Basic
    @Column(name = "FILE_NAME", nullable = true, length = 255)
    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    @Basic
    @Column(name = "FILE_PATH", nullable = true, length = 255)
    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    @Basic
    @Column(name = "SIZE", nullable = true, precision = 0)
    public Double getSize() {
        return size;
    }

    public void setSize(Double size) {
        this.size = size;
    }

    @Basic
    @Column(name = "REMARK", nullable = true, length = 255)
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Basic
    @Column(name = "CREATE_TIME", nullable = true)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "UPDATE_TIME", nullable = true)
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        FileModel fileModel = (FileModel) o;

        if (fileId != null ? !fileId.equals(fileModel.fileId) : fileModel.fileId != null) return false;
        if (fileName != null ? !fileName.equals(fileModel.fileName) : fileModel.fileName != null) return false;
        if (filePath != null ? !filePath.equals(fileModel.filePath) : fileModel.filePath != null) return false;
        if (size != null ? !size.equals(fileModel.size) : fileModel.size != null) return false;
        if (remark != null ? !remark.equals(fileModel.remark) : fileModel.remark != null) return false;
        if (createTime != null ? !createTime.equals(fileModel.createTime) : fileModel.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(fileModel.updateTime) : fileModel.updateTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = fileId != null ? fileId.hashCode() : 0;
        result = 31 * result + (fileName != null ? fileName.hashCode() : 0);
        result = 31 * result + (filePath != null ? filePath.hashCode() : 0);
        result = 31 * result + (size != null ? size.hashCode() : 0);
        result = 31 * result + (remark != null ? remark.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }
}
